Skip to content

docs: Updated README to Have Types #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 11, 2018
Merged

Conversation

smacpherson64
Copy link
Collaborator

@smacpherson64 smacpherson64 commented Jul 11, 2018

What:

Updating readme to have types

Why:
To complete #33

How:
Added types (typescript types without return values)

Checklist:

  • Documentation N/A
  • Tests N/A
  • Ready to be merged
  • Added myself to contributors table N/A

Closes #33

@smacpherson64 smacpherson64 requested a review from gnapse July 11, 2018 14:57
@codecov-io
Copy link

codecov-io commented Jul 11, 2018

Codecov Report

Merging #36 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #36   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines         100    100           
  Branches       20     20           
=====================================
  Hits          100    100

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1cf41a4...8fe6e38. Read the comment docs.

Copy link
Member

@gnapse gnapse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Just need some clarification regarding the SVGElement support.

README.md Outdated
@@ -99,6 +99,10 @@ expect.extend({toBeInTheDOM, toHaveClass})

### `toBeInTheDOM`

```
toBeInTheDOM(container?: HTMLElement)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since #29 we also support SGVElement, which for some reason is a class of its own. I guess we missed reflecting this change in the typescript types too, so maybe we could take the opportunity to reflect the change in that file as well as in the README.

@jgoz since you worked in #29 and also have worked on TypeScript stuff in this repo, can you confirm the typescript signatures need to be updated to reflect that they support sag elements as well?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnapse That's a good question. I suppose it's possible that someone would be using an SVG element as a container, so maybe we should update the signature as follows (both in the readme and in definitions):

toBeInTheDOM(container?: HTMLElement | SVGElement)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know. Are you up for it @jgoz? If not don't worry, maybe @smacpherson64 or I can do it later.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, I can add it to my list today.

README.md Outdated
@@ -152,6 +160,10 @@ expect(queryByTestId(container, 'not-empty')).not.toBeEmpty()

### `toContainElement`

```
toContainElement(element: HTMLElement)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing about the SVGElement support mentioned above.

@gnapse
Copy link
Member

gnapse commented Jul 11, 2018

BTW @smacpherson64 I'm not sure this qualifies as a fix: commit. Maybe if we end-up needing to update the typescript typings, then yes. But if it's only a README change, it should be docs:. This is for the squash-merge commit. There's no problem with these intermediate commits to have the fix: prefix. I think.

@smacpherson64
Copy link
Collaborator Author

About the docs: sounds good, I will make sure to do that going forward!

@smacpherson64 smacpherson64 changed the title fix: Updated README to Have Types docs: Updated README to Have Types Jul 11, 2018
@gnapse
Copy link
Member

gnapse commented Jul 11, 2018

If we need to update the typescript definitions, as I suspect, then it's a fix. Or we can leave it as is and make that fix separately. So maybe we can go forward with this as is. Feel free to do as you prefer.

@smacpherson64
Copy link
Collaborator Author

I think we should keep them separate and make a new issue to validate and fix the types. I am fairly sure we will need to add SVGElement as well:

document.createElementNS("http://www.w3.org/2000/svg", "svg") instanceof HTMLElement; // false

/* From: https://stackoverflow.com/questions/24174975/document-createelementsvg-instanceof-svgelement-is-false */

@gnapse
Copy link
Member

gnapse commented Jul 11, 2018

+1 to leave the fix for a separate PR.

But now I have a suggestion for this one that I missed on my initial review. We should either make those code blocks syntax-aware of typescript (putting typescript after the initial set of three backticks), or maybe we can make the function signature in the section title itself. What do you think?

If we keep the current format (that is, the signature after the section title) then we must make that block syntax-aware of typescript though.

@smacpherson64
Copy link
Collaborator Author

I added typescript to the code blocks as I do not know how adding them to the headers will affect linking.

README.md Outdated
```typescript
toHaveClass(...classNames: string[])
```

This allows you to check wether the given element has certain classes within its
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: wether should be whether (it's misspelled in a few spots)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Thanks!

README.md Outdated
@@ -99,6 +99,10 @@ expect.extend({toBeInTheDOM, toHaveClass})

### `toBeInTheDOM`

```
toBeInTheDOM(container?: HTMLElement)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnapse That's a good question. I suppose it's possible that someone would be using an SVG element as a container, so maybe we should update the signature as follows (both in the readme and in definitions):

toBeInTheDOM(container?: HTMLElement | SVGElement)

As found by @jgoz fixing wether -> whether typo
@gnapse
Copy link
Member

gnapse commented Jul 11, 2018

Yes, good point regarding the links. They'd be updated, since the TOC is auto-generated, and it would all work, but it's ok this way anyway. Feel free to merge this, and remember to set the docs: prefix. Thanks!

@smacpherson64 smacpherson64 merged commit a57e3d3 into master Jul 11, 2018
@gnapse gnapse deleted the pr/readme-types-update branch July 11, 2018 16:39
@gnapse
Copy link
Member

gnapse commented Jul 11, 2018

🎉 This PR is included in version 1.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants